// 站内信列表视图

Ext.define("app.view.staff.InternalMsg",{
	extend: 'Ext.grid.Panel',
	alias: 'widget.internalMsg',
	store: 'InternalMsgStore',
	selModel: {
		selType: 'checkboxmodel'//选择模式， 复选框模式
	},	
	multiSelect: true,//允许多选
	frame: true,// 填充画面
	enableKeyNav: true,//键盘方向
	columnLines: true,//竖线	 
	stripeRows: true,
	tbar: [{
		xtype: 'button',
		text: '我的站内信',
		action: 'allMsg'
	}, {
		xtype: 'button',
		text: '未读信息',
		action: 'unreadMsg'
	}, {
		xtype: 'button',
		text: '发送站内信',
		action: 'sendMsg'
	}, {
		xtype: 'button',
		text: '删除',
		action: 'removeMsg'
	}, {
		xtype: 'form',
		id: 'searchMsgForm',
		width: 740,
		height: 22,
		border: false,
		layout: 'column',
		defaultType: 'textfield',
		items: [{
			xtype: 'combobox',
			name: 'searchType',
			width: 120,
			store: 'InternalMsgSearchTypeStore',
			displayField: 'stname',
			valueField: 'stid',
			emptyText: '默认（按标题）',
			editable: false
		}, {
			name: 'keyword',
			width: 200       
		}, {
			xtype: 'button',
			text: '时间段'       
		}, {
			xtype: 'datefield',
			name: 'stime',
			editable: false,
			width: 100       
		}, {
			xtype: 'panel',
			html: '到',
			width: 20,
			height: 25,
			border: false,
			style: 'text-align: center;margin-top: 5px'
		}, {
			xtype: 'datefield',
			name: 'etime',
			editable: false,
			width: 100       
		}, {
			xtype: 'radiogroup',
			width: 100,
			items: [{
				boxLabel: '所有',
				name: 'msgType',
				inputValue: '1',
				checked: true
			}, {
				boxLabel: '未读',
				name: 'msgType',
				inputValue: '0'
			}]
		}, {
			xtype: 'button',
			text: '搜索',
			width: 50,
			action: 'submitSearchMsg'
		}]
	}],

	dockedItems: [{//自定义工具栏
		xtype: 'pagingtoolbar',//分页工具栏
		store: 'InternalMsgStore',//引用的store
		pageSize: 8,
		dock: 'bottom',//位置在底部
		displayInfo: true//显示信息
	}], 

	columns:[//表格列字段
//	   new Ext.grid.RowNumberer(),//序号
	{
		 text: '编号',
		 dataIndex: 'id',
		 width: 50
	}, {
		text: '状态',
		dataIndex: 'status',
		width: 50, 
		renderer: function(v){
			if(v == 1){
				return '<img src="'+ ROOT +'/Public/images/folder-skyblue.png" width="20" />';
			}else if(v == 0){
				return '<img src="'+ ROOT +'/Public/images/foldernew.png" width="20" />';
			}
		}
	}, {
		text: '发信人',
		dataIndex: 'fromname',
		width: 100, 
		renderer: function(v){
			if (v == USERNAME) return '<strong style="color:red">'+ v +'</strong>';
			else return v;
		}
	}, {
		text: '收信人',
		dataIndex: 'toname',
		width: 100, 
		renderer: function(v){
			if (v == USERNAME) return '<strong style="color:red">'+ v +'</strong>';
			else return v;
		}
	}, {
		text: '标题',
		dataIndex: 'title',
		width: 100
	}, {
		text: '内容',
		dataIndex: 'content',		   
		flex: 1
	}, {
		text: '时间',
		dataIndex: 'sendtime',		   
		width: 150
	}],
	 

	initComponent: function(){//初始化方法
		this.callParent(arguments);		
	}
});